define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'business.shop/index/district_id/'+districtId,
        add_url: 'business.shop/add',
        edit_url: 'business.shop/edit',
        delete_url: 'business.shop/delete',
        export_url: 'business.shop/export',
        modify_url: 'business.shop/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: '店铺ID',search:false},
                    {field: 'category_name', title: '分类名称'},
                    {field: 'name', title: '店铺名称',fieldAlias:'s.name'},
                    {field: 'logo', title: '店铺logo',imageHeight:80, templet: ea.table.image, search: false},
                    {field: 'nickname', title: '老板',search:false},
                    {field: 'shop_code', title: '商家编码'},
                    // {field: 'create_time', title: '创建时间', width: 200, search: 'range'},
                    {
                        width: 100, title: '操作', templet: ea.table.tool, operat: ['edit']
                    },
                ]],
                done: function () {
                    $(".layui-table-body>table>tbody>tr").each(function (index, val) {
                        $($(".layui-table-fixed .layui-table-body table tr")[index]).height($(val).height());
                    });
                },
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});